# Время по которое удаляются блоки
set @REMOVE_TO_TIME = '2021-11-01';

# begin;

# Удаление блоков команд и событий
delete s5commandblob, s5commandblock from s5commandblob INNER JOIN s5commandblock where s5commandblob.gwid = s5commandblock.gwid and s5commandblock.debugEndTime < @REMOVE_TO_TIME;
delete s5eventblob, s5eventblock from s5eventblob INNER JOIN s5eventblock where s5eventblob.gwid = s5eventblock.gwid and s5eventblock.debugEndTime < @REMOVE_TO_TIME;


# Удаление блоков асинхронных данных
delete s5histdataasyncbooleanblobentity0, s5histdataasyncbooleanentity0 from s5histdataasyncbooleanblobentity0 INNER JOIN s5histdataasyncbooleanentity0 where s5histdataasyncbooleanblobentity0.gwid = s5histdataasyncbooleanentity0.gwid and s5histdataasyncbooleanentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity1, s5histdataasyncbooleanentity1 from s5histdataasyncbooleanblobentity1 INNER JOIN s5histdataasyncbooleanentity1 where s5histdataasyncbooleanblobentity1.gwid = s5histdataasyncbooleanentity1.gwid and s5histdataasyncbooleanentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity2, s5histdataasyncbooleanentity2 from s5histdataasyncbooleanblobentity2 INNER JOIN s5histdataasyncbooleanentity2 where s5histdataasyncbooleanblobentity2.gwid = s5histdataasyncbooleanentity2.gwid and s5histdataasyncbooleanentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity3, s5histdataasyncbooleanentity3 from s5histdataasyncbooleanblobentity3 INNER JOIN s5histdataasyncbooleanentity3 where s5histdataasyncbooleanblobentity3.gwid = s5histdataasyncbooleanentity3.gwid and s5histdataasyncbooleanentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity4, s5histdataasyncbooleanentity4 from s5histdataasyncbooleanblobentity4 INNER JOIN s5histdataasyncbooleanentity4 where s5histdataasyncbooleanblobentity4.gwid = s5histdataasyncbooleanentity4.gwid and s5histdataasyncbooleanentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity5, s5histdataasyncbooleanentity5 from s5histdataasyncbooleanblobentity5 INNER JOIN s5histdataasyncbooleanentity5 where s5histdataasyncbooleanblobentity5.gwid = s5histdataasyncbooleanentity5.gwid and s5histdataasyncbooleanentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity6, s5histdataasyncbooleanentity6 from s5histdataasyncbooleanblobentity6 INNER JOIN s5histdataasyncbooleanentity6 where s5histdataasyncbooleanblobentity6.gwid = s5histdataasyncbooleanentity6.gwid and s5histdataasyncbooleanentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity7, s5histdataasyncbooleanentity7 from s5histdataasyncbooleanblobentity7 INNER JOIN s5histdataasyncbooleanentity7 where s5histdataasyncbooleanblobentity7.gwid = s5histdataasyncbooleanentity7.gwid and s5histdataasyncbooleanentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity8, s5histdataasyncbooleanentity8 from s5histdataasyncbooleanblobentity8 INNER JOIN s5histdataasyncbooleanentity8 where s5histdataasyncbooleanblobentity8.gwid = s5histdataasyncbooleanentity8.gwid and s5histdataasyncbooleanentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncbooleanblobentity9, s5histdataasyncbooleanentity9 from s5histdataasyncbooleanblobentity9 INNER JOIN s5histdataasyncbooleanentity9 where s5histdataasyncbooleanblobentity9.gwid = s5histdataasyncbooleanentity9.gwid and s5histdataasyncbooleanentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdataasyncvalobjblobentity0, s5histdataasyncvalobjentity0 from s5histdataasyncvalobjblobentity0 INNER JOIN s5histdataasyncvalobjentity0 where s5histdataasyncvalobjblobentity0.gwid = s5histdataasyncvalobjentity0.gwid and s5histdataasyncvalobjentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity1, s5histdataasyncvalobjentity1 from s5histdataasyncvalobjblobentity1 INNER JOIN s5histdataasyncvalobjentity1 where s5histdataasyncvalobjblobentity1.gwid = s5histdataasyncvalobjentity1.gwid and s5histdataasyncvalobjentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity2, s5histdataasyncvalobjentity2 from s5histdataasyncvalobjblobentity2 INNER JOIN s5histdataasyncvalobjentity2 where s5histdataasyncvalobjblobentity2.gwid = s5histdataasyncvalobjentity2.gwid and s5histdataasyncvalobjentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity3, s5histdataasyncvalobjentity3 from s5histdataasyncvalobjblobentity3 INNER JOIN s5histdataasyncvalobjentity3 where s5histdataasyncvalobjblobentity3.gwid = s5histdataasyncvalobjentity3.gwid and s5histdataasyncvalobjentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity4, s5histdataasyncvalobjentity4 from s5histdataasyncvalobjblobentity4 INNER JOIN s5histdataasyncvalobjentity4 where s5histdataasyncvalobjblobentity4.gwid = s5histdataasyncvalobjentity4.gwid and s5histdataasyncvalobjentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity5, s5histdataasyncvalobjentity5 from s5histdataasyncvalobjblobentity5 INNER JOIN s5histdataasyncvalobjentity5 where s5histdataasyncvalobjblobentity5.gwid = s5histdataasyncvalobjentity5.gwid and s5histdataasyncvalobjentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity6, s5histdataasyncvalobjentity6 from s5histdataasyncvalobjblobentity6 INNER JOIN s5histdataasyncvalobjentity6 where s5histdataasyncvalobjblobentity6.gwid = s5histdataasyncvalobjentity6.gwid and s5histdataasyncvalobjentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity7, s5histdataasyncvalobjentity7 from s5histdataasyncvalobjblobentity7 INNER JOIN s5histdataasyncvalobjentity7 where s5histdataasyncvalobjblobentity7.gwid = s5histdataasyncvalobjentity7.gwid and s5histdataasyncvalobjentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity8, s5histdataasyncvalobjentity8 from s5histdataasyncvalobjblobentity8 INNER JOIN s5histdataasyncvalobjentity8 where s5histdataasyncvalobjblobentity8.gwid = s5histdataasyncvalobjentity8.gwid and s5histdataasyncvalobjentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncvalobjblobentity9, s5histdataasyncvalobjentity9 from s5histdataasyncvalobjblobentity9 INNER JOIN s5histdataasyncvalobjentity9 where s5histdataasyncvalobjblobentity9.gwid = s5histdataasyncvalobjentity9.gwid and s5histdataasyncvalobjentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdataasyncfloatingblobentity0, s5histdataasyncfloatingentity0 from s5histdataasyncfloatingblobentity0 INNER JOIN s5histdataasyncfloatingentity0 where s5histdataasyncfloatingblobentity0.gwid = s5histdataasyncfloatingentity0.gwid and s5histdataasyncfloatingentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity1, s5histdataasyncfloatingentity1 from s5histdataasyncfloatingblobentity1 INNER JOIN s5histdataasyncfloatingentity1 where s5histdataasyncfloatingblobentity1.gwid = s5histdataasyncfloatingentity1.gwid and s5histdataasyncfloatingentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity2, s5histdataasyncfloatingentity2 from s5histdataasyncfloatingblobentity2 INNER JOIN s5histdataasyncfloatingentity2 where s5histdataasyncfloatingblobentity2.gwid = s5histdataasyncfloatingentity2.gwid and s5histdataasyncfloatingentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity3, s5histdataasyncfloatingentity3 from s5histdataasyncfloatingblobentity3 INNER JOIN s5histdataasyncfloatingentity3 where s5histdataasyncfloatingblobentity3.gwid = s5histdataasyncfloatingentity3.gwid and s5histdataasyncfloatingentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity4, s5histdataasyncfloatingentity4 from s5histdataasyncfloatingblobentity4 INNER JOIN s5histdataasyncfloatingentity4 where s5histdataasyncfloatingblobentity4.gwid = s5histdataasyncfloatingentity4.gwid and s5histdataasyncfloatingentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity5, s5histdataasyncfloatingentity5 from s5histdataasyncfloatingblobentity5 INNER JOIN s5histdataasyncfloatingentity5 where s5histdataasyncfloatingblobentity5.gwid = s5histdataasyncfloatingentity5.gwid and s5histdataasyncfloatingentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity6, s5histdataasyncfloatingentity6 from s5histdataasyncfloatingblobentity6 INNER JOIN s5histdataasyncfloatingentity6 where s5histdataasyncfloatingblobentity6.gwid = s5histdataasyncfloatingentity6.gwid and s5histdataasyncfloatingentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity7, s5histdataasyncfloatingentity7 from s5histdataasyncfloatingblobentity7 INNER JOIN s5histdataasyncfloatingentity7 where s5histdataasyncfloatingblobentity7.gwid = s5histdataasyncfloatingentity7.gwid and s5histdataasyncfloatingentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity8, s5histdataasyncfloatingentity8 from s5histdataasyncfloatingblobentity8 INNER JOIN s5histdataasyncfloatingentity8 where s5histdataasyncfloatingblobentity8.gwid = s5histdataasyncfloatingentity8.gwid and s5histdataasyncfloatingentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncfloatingblobentity9, s5histdataasyncfloatingentity9 from s5histdataasyncfloatingblobentity9 INNER JOIN s5histdataasyncfloatingentity9 where s5histdataasyncfloatingblobentity9.gwid = s5histdataasyncfloatingentity9.gwid and s5histdataasyncfloatingentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdataasyncintegerblobentity0, s5histdataasyncintegerentity0 from s5histdataasyncintegerblobentity0 INNER JOIN s5histdataasyncintegerentity0 where s5histdataasyncintegerblobentity0.gwid = s5histdataasyncintegerentity0.gwid and s5histdataasyncintegerentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity1, s5histdataasyncintegerentity1 from s5histdataasyncintegerblobentity1 INNER JOIN s5histdataasyncintegerentity1 where s5histdataasyncintegerblobentity1.gwid = s5histdataasyncintegerentity1.gwid and s5histdataasyncintegerentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity2, s5histdataasyncintegerentity2 from s5histdataasyncintegerblobentity2 INNER JOIN s5histdataasyncintegerentity2 where s5histdataasyncintegerblobentity2.gwid = s5histdataasyncintegerentity2.gwid and s5histdataasyncintegerentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity3, s5histdataasyncintegerentity3 from s5histdataasyncintegerblobentity3 INNER JOIN s5histdataasyncintegerentity3 where s5histdataasyncintegerblobentity3.gwid = s5histdataasyncintegerentity3.gwid and s5histdataasyncintegerentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity4, s5histdataasyncintegerentity4 from s5histdataasyncintegerblobentity4 INNER JOIN s5histdataasyncintegerentity4 where s5histdataasyncintegerblobentity4.gwid = s5histdataasyncintegerentity4.gwid and s5histdataasyncintegerentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity5, s5histdataasyncintegerentity5 from s5histdataasyncintegerblobentity5 INNER JOIN s5histdataasyncintegerentity5 where s5histdataasyncintegerblobentity5.gwid = s5histdataasyncintegerentity5.gwid and s5histdataasyncintegerentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity6, s5histdataasyncintegerentity6 from s5histdataasyncintegerblobentity6 INNER JOIN s5histdataasyncintegerentity6 where s5histdataasyncintegerblobentity6.gwid = s5histdataasyncintegerentity6.gwid and s5histdataasyncintegerentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity7, s5histdataasyncintegerentity7 from s5histdataasyncintegerblobentity7 INNER JOIN s5histdataasyncintegerentity7 where s5histdataasyncintegerblobentity7.gwid = s5histdataasyncintegerentity7.gwid and s5histdataasyncintegerentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity8, s5histdataasyncintegerentity8 from s5histdataasyncintegerblobentity8 INNER JOIN s5histdataasyncintegerentity8 where s5histdataasyncintegerblobentity8.gwid = s5histdataasyncintegerentity8.gwid and s5histdataasyncintegerentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncintegerblobentity9, s5histdataasyncintegerentity9 from s5histdataasyncintegerblobentity9 INNER JOIN s5histdataasyncintegerentity9 where s5histdataasyncintegerblobentity9.gwid = s5histdataasyncintegerentity9.gwid and s5histdataasyncintegerentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdataasyncstringblobentity0, s5histdataasyncstringentity0 from s5histdataasyncstringblobentity0 INNER JOIN s5histdataasyncstringentity0 where s5histdataasyncstringblobentity0.gwid = s5histdataasyncstringentity0.gwid and s5histdataasyncstringentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity1, s5histdataasyncstringentity1 from s5histdataasyncstringblobentity1 INNER JOIN s5histdataasyncstringentity1 where s5histdataasyncstringblobentity1.gwid = s5histdataasyncstringentity1.gwid and s5histdataasyncstringentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity2, s5histdataasyncstringentity2 from s5histdataasyncstringblobentity2 INNER JOIN s5histdataasyncstringentity2 where s5histdataasyncstringblobentity2.gwid = s5histdataasyncstringentity2.gwid and s5histdataasyncstringentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity3, s5histdataasyncstringentity3 from s5histdataasyncstringblobentity3 INNER JOIN s5histdataasyncstringentity3 where s5histdataasyncstringblobentity3.gwid = s5histdataasyncstringentity3.gwid and s5histdataasyncstringentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity4, s5histdataasyncstringentity4 from s5histdataasyncstringblobentity4 INNER JOIN s5histdataasyncstringentity4 where s5histdataasyncstringblobentity4.gwid = s5histdataasyncstringentity4.gwid and s5histdataasyncstringentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity5, s5histdataasyncstringentity5 from s5histdataasyncstringblobentity5 INNER JOIN s5histdataasyncstringentity5 where s5histdataasyncstringblobentity5.gwid = s5histdataasyncstringentity5.gwid and s5histdataasyncstringentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity6, s5histdataasyncstringentity6 from s5histdataasyncstringblobentity6 INNER JOIN s5histdataasyncstringentity6 where s5histdataasyncstringblobentity6.gwid = s5histdataasyncstringentity6.gwid and s5histdataasyncstringentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity7, s5histdataasyncstringentity7 from s5histdataasyncstringblobentity7 INNER JOIN s5histdataasyncstringentity7 where s5histdataasyncstringblobentity7.gwid = s5histdataasyncstringentity7.gwid and s5histdataasyncstringentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity8, s5histdataasyncstringentity8 from s5histdataasyncstringblobentity8 INNER JOIN s5histdataasyncstringentity8 where s5histdataasyncstringblobentity8.gwid = s5histdataasyncstringentity8.gwid and s5histdataasyncstringentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasyncstringblobentity9, s5histdataasyncstringentity9 from s5histdataasyncstringblobentity9 INNER JOIN s5histdataasyncstringentity9 where s5histdataasyncstringblobentity9.gwid = s5histdataasyncstringentity9.gwid and s5histdataasyncstringentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdataasynctimestampblobentity0, s5histdataasynctimestampentity0 from s5histdataasynctimestampblobentity0 INNER JOIN s5histdataasynctimestampentity0 where s5histdataasynctimestampblobentity0.gwid = s5histdataasynctimestampentity0.gwid and s5histdataasynctimestampentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity1, s5histdataasynctimestampentity1 from s5histdataasynctimestampblobentity1 INNER JOIN s5histdataasynctimestampentity1 where s5histdataasynctimestampblobentity1.gwid = s5histdataasynctimestampentity1.gwid and s5histdataasynctimestampentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity2, s5histdataasynctimestampentity2 from s5histdataasynctimestampblobentity2 INNER JOIN s5histdataasynctimestampentity2 where s5histdataasynctimestampblobentity2.gwid = s5histdataasynctimestampentity2.gwid and s5histdataasynctimestampentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity3, s5histdataasynctimestampentity3 from s5histdataasynctimestampblobentity3 INNER JOIN s5histdataasynctimestampentity3 where s5histdataasynctimestampblobentity3.gwid = s5histdataasynctimestampentity3.gwid and s5histdataasynctimestampentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity4, s5histdataasynctimestampentity4 from s5histdataasynctimestampblobentity4 INNER JOIN s5histdataasynctimestampentity4 where s5histdataasynctimestampblobentity4.gwid = s5histdataasynctimestampentity4.gwid and s5histdataasynctimestampentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity5, s5histdataasynctimestampentity5 from s5histdataasynctimestampblobentity5 INNER JOIN s5histdataasynctimestampentity5 where s5histdataasynctimestampblobentity5.gwid = s5histdataasynctimestampentity5.gwid and s5histdataasynctimestampentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity6, s5histdataasynctimestampentity6 from s5histdataasynctimestampblobentity6 INNER JOIN s5histdataasynctimestampentity6 where s5histdataasynctimestampblobentity6.gwid = s5histdataasynctimestampentity6.gwid and s5histdataasynctimestampentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity7, s5histdataasynctimestampentity7 from s5histdataasynctimestampblobentity7 INNER JOIN s5histdataasynctimestampentity7 where s5histdataasynctimestampblobentity7.gwid = s5histdataasynctimestampentity7.gwid and s5histdataasynctimestampentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity8, s5histdataasynctimestampentity8 from s5histdataasynctimestampblobentity8 INNER JOIN s5histdataasynctimestampentity8 where s5histdataasynctimestampblobentity8.gwid = s5histdataasynctimestampentity8.gwid and s5histdataasynctimestampentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdataasynctimestampblobentity9, s5histdataasynctimestampentity9 from s5histdataasynctimestampblobentity9 INNER JOIN s5histdataasynctimestampentity9 where s5histdataasynctimestampblobentity9.gwid = s5histdataasynctimestampentity9.gwid and s5histdataasynctimestampentity9.debugEndTime < @REMOVE_TO_TIME;

# Удаление блоков синхронных данных
delete s5histdatasyncbooleanblobentity0, s5histdatasyncbooleanentity0 from s5histdatasyncbooleanblobentity0 INNER JOIN s5histdatasyncbooleanentity0 where s5histdatasyncbooleanblobentity0.gwid = s5histdatasyncbooleanentity0.gwid and s5histdatasyncbooleanentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity1, s5histdatasyncbooleanentity1 from s5histdatasyncbooleanblobentity1 INNER JOIN s5histdatasyncbooleanentity1 where s5histdatasyncbooleanblobentity1.gwid = s5histdatasyncbooleanentity1.gwid and s5histdatasyncbooleanentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity2, s5histdatasyncbooleanentity2 from s5histdatasyncbooleanblobentity2 INNER JOIN s5histdatasyncbooleanentity2 where s5histdatasyncbooleanblobentity2.gwid = s5histdatasyncbooleanentity2.gwid and s5histdatasyncbooleanentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity3, s5histdatasyncbooleanentity3 from s5histdatasyncbooleanblobentity3 INNER JOIN s5histdatasyncbooleanentity3 where s5histdatasyncbooleanblobentity3.gwid = s5histdatasyncbooleanentity3.gwid and s5histdatasyncbooleanentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity4, s5histdatasyncbooleanentity4 from s5histdatasyncbooleanblobentity4 INNER JOIN s5histdatasyncbooleanentity4 where s5histdatasyncbooleanblobentity4.gwid = s5histdatasyncbooleanentity4.gwid and s5histdatasyncbooleanentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity5, s5histdatasyncbooleanentity5 from s5histdatasyncbooleanblobentity5 INNER JOIN s5histdatasyncbooleanentity5 where s5histdatasyncbooleanblobentity5.gwid = s5histdatasyncbooleanentity5.gwid and s5histdatasyncbooleanentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity6, s5histdatasyncbooleanentity6 from s5histdatasyncbooleanblobentity6 INNER JOIN s5histdatasyncbooleanentity6 where s5histdatasyncbooleanblobentity6.gwid = s5histdatasyncbooleanentity6.gwid and s5histdatasyncbooleanentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity7, s5histdatasyncbooleanentity7 from s5histdatasyncbooleanblobentity7 INNER JOIN s5histdatasyncbooleanentity7 where s5histdatasyncbooleanblobentity7.gwid = s5histdatasyncbooleanentity7.gwid and s5histdatasyncbooleanentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity8, s5histdatasyncbooleanentity8 from s5histdatasyncbooleanblobentity8 INNER JOIN s5histdatasyncbooleanentity8 where s5histdatasyncbooleanblobentity8.gwid = s5histdatasyncbooleanentity8.gwid and s5histdatasyncbooleanentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncbooleanblobentity9, s5histdatasyncbooleanentity9 from s5histdatasyncbooleanblobentity9 INNER JOIN s5histdatasyncbooleanentity9 where s5histdatasyncbooleanblobentity9.gwid = s5histdatasyncbooleanentity9.gwid and s5histdatasyncbooleanentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdatasyncvalobjblobentity0, s5histdatasyncvalobjentity0 from s5histdatasyncvalobjblobentity0 INNER JOIN s5histdatasyncvalobjentity0 where s5histdatasyncvalobjblobentity0.gwid = s5histdatasyncvalobjentity0.gwid and s5histdatasyncvalobjentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity1, s5histdatasyncvalobjentity1 from s5histdatasyncvalobjblobentity1 INNER JOIN s5histdatasyncvalobjentity1 where s5histdatasyncvalobjblobentity1.gwid = s5histdatasyncvalobjentity1.gwid and s5histdatasyncvalobjentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity2, s5histdatasyncvalobjentity2 from s5histdatasyncvalobjblobentity2 INNER JOIN s5histdatasyncvalobjentity2 where s5histdatasyncvalobjblobentity2.gwid = s5histdatasyncvalobjentity2.gwid and s5histdatasyncvalobjentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity3, s5histdatasyncvalobjentity3 from s5histdatasyncvalobjblobentity3 INNER JOIN s5histdatasyncvalobjentity3 where s5histdatasyncvalobjblobentity3.gwid = s5histdatasyncvalobjentity3.gwid and s5histdatasyncvalobjentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity4, s5histdatasyncvalobjentity4 from s5histdatasyncvalobjblobentity4 INNER JOIN s5histdatasyncvalobjentity4 where s5histdatasyncvalobjblobentity4.gwid = s5histdatasyncvalobjentity4.gwid and s5histdatasyncvalobjentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity5, s5histdatasyncvalobjentity5 from s5histdatasyncvalobjblobentity5 INNER JOIN s5histdatasyncvalobjentity5 where s5histdatasyncvalobjblobentity5.gwid = s5histdatasyncvalobjentity5.gwid and s5histdatasyncvalobjentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity6, s5histdatasyncvalobjentity6 from s5histdatasyncvalobjblobentity6 INNER JOIN s5histdatasyncvalobjentity6 where s5histdatasyncvalobjblobentity6.gwid = s5histdatasyncvalobjentity6.gwid and s5histdatasyncvalobjentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity7, s5histdatasyncvalobjentity7 from s5histdatasyncvalobjblobentity7 INNER JOIN s5histdatasyncvalobjentity7 where s5histdatasyncvalobjblobentity7.gwid = s5histdatasyncvalobjentity7.gwid and s5histdatasyncvalobjentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity8, s5histdatasyncvalobjentity8 from s5histdatasyncvalobjblobentity8 INNER JOIN s5histdatasyncvalobjentity8 where s5histdatasyncvalobjblobentity8.gwid = s5histdatasyncvalobjentity8.gwid and s5histdatasyncvalobjentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncvalobjblobentity9, s5histdatasyncvalobjentity9 from s5histdatasyncvalobjblobentity9 INNER JOIN s5histdatasyncvalobjentity9 where s5histdatasyncvalobjblobentity9.gwid = s5histdatasyncvalobjentity9.gwid and s5histdatasyncvalobjentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdatasyncfloatingblobentity0, s5histdatasyncfloatingentity0 from s5histdatasyncfloatingblobentity0 INNER JOIN s5histdatasyncfloatingentity0 where s5histdatasyncfloatingblobentity0.gwid = s5histdatasyncfloatingentity0.gwid and s5histdatasyncfloatingentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity1, s5histdatasyncfloatingentity1 from s5histdatasyncfloatingblobentity1 INNER JOIN s5histdatasyncfloatingentity1 where s5histdatasyncfloatingblobentity1.gwid = s5histdatasyncfloatingentity1.gwid and s5histdatasyncfloatingentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity2, s5histdatasyncfloatingentity2 from s5histdatasyncfloatingblobentity2 INNER JOIN s5histdatasyncfloatingentity2 where s5histdatasyncfloatingblobentity2.gwid = s5histdatasyncfloatingentity2.gwid and s5histdatasyncfloatingentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity3, s5histdatasyncfloatingentity3 from s5histdatasyncfloatingblobentity3 INNER JOIN s5histdatasyncfloatingentity3 where s5histdatasyncfloatingblobentity3.gwid = s5histdatasyncfloatingentity3.gwid and s5histdatasyncfloatingentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity4, s5histdatasyncfloatingentity4 from s5histdatasyncfloatingblobentity4 INNER JOIN s5histdatasyncfloatingentity4 where s5histdatasyncfloatingblobentity4.gwid = s5histdatasyncfloatingentity4.gwid and s5histdatasyncfloatingentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity5, s5histdatasyncfloatingentity5 from s5histdatasyncfloatingblobentity5 INNER JOIN s5histdatasyncfloatingentity5 where s5histdatasyncfloatingblobentity5.gwid = s5histdatasyncfloatingentity5.gwid and s5histdatasyncfloatingentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity6, s5histdatasyncfloatingentity6 from s5histdatasyncfloatingblobentity6 INNER JOIN s5histdatasyncfloatingentity6 where s5histdatasyncfloatingblobentity6.gwid = s5histdatasyncfloatingentity6.gwid and s5histdatasyncfloatingentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity7, s5histdatasyncfloatingentity7 from s5histdatasyncfloatingblobentity7 INNER JOIN s5histdatasyncfloatingentity7 where s5histdatasyncfloatingblobentity7.gwid = s5histdatasyncfloatingentity7.gwid and s5histdatasyncfloatingentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity8, s5histdatasyncfloatingentity8 from s5histdatasyncfloatingblobentity8 INNER JOIN s5histdatasyncfloatingentity8 where s5histdatasyncfloatingblobentity8.gwid = s5histdatasyncfloatingentity8.gwid and s5histdatasyncfloatingentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncfloatingblobentity9, s5histdatasyncfloatingentity9 from s5histdatasyncfloatingblobentity9 INNER JOIN s5histdatasyncfloatingentity9 where s5histdatasyncfloatingblobentity9.gwid = s5histdatasyncfloatingentity9.gwid and s5histdatasyncfloatingentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdatasyncintegerblobentity0, s5histdatasyncintegerentity0 from s5histdatasyncintegerblobentity0 INNER JOIN s5histdatasyncintegerentity0 where s5histdatasyncintegerblobentity0.gwid = s5histdatasyncintegerentity0.gwid and s5histdatasyncintegerentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity1, s5histdatasyncintegerentity1 from s5histdatasyncintegerblobentity1 INNER JOIN s5histdatasyncintegerentity1 where s5histdatasyncintegerblobentity1.gwid = s5histdatasyncintegerentity1.gwid and s5histdatasyncintegerentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity2, s5histdatasyncintegerentity2 from s5histdatasyncintegerblobentity2 INNER JOIN s5histdatasyncintegerentity2 where s5histdatasyncintegerblobentity2.gwid = s5histdatasyncintegerentity2.gwid and s5histdatasyncintegerentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity3, s5histdatasyncintegerentity3 from s5histdatasyncintegerblobentity3 INNER JOIN s5histdatasyncintegerentity3 where s5histdatasyncintegerblobentity3.gwid = s5histdatasyncintegerentity3.gwid and s5histdatasyncintegerentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity4, s5histdatasyncintegerentity4 from s5histdatasyncintegerblobentity4 INNER JOIN s5histdatasyncintegerentity4 where s5histdatasyncintegerblobentity4.gwid = s5histdatasyncintegerentity4.gwid and s5histdatasyncintegerentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity5, s5histdatasyncintegerentity5 from s5histdatasyncintegerblobentity5 INNER JOIN s5histdatasyncintegerentity5 where s5histdatasyncintegerblobentity5.gwid = s5histdatasyncintegerentity5.gwid and s5histdatasyncintegerentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity6, s5histdatasyncintegerentity6 from s5histdatasyncintegerblobentity6 INNER JOIN s5histdatasyncintegerentity6 where s5histdatasyncintegerblobentity6.gwid = s5histdatasyncintegerentity6.gwid and s5histdatasyncintegerentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity7, s5histdatasyncintegerentity7 from s5histdatasyncintegerblobentity7 INNER JOIN s5histdatasyncintegerentity7 where s5histdatasyncintegerblobentity7.gwid = s5histdatasyncintegerentity7.gwid and s5histdatasyncintegerentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity8, s5histdatasyncintegerentity8 from s5histdatasyncintegerblobentity8 INNER JOIN s5histdatasyncintegerentity8 where s5histdatasyncintegerblobentity8.gwid = s5histdatasyncintegerentity8.gwid and s5histdatasyncintegerentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncintegerblobentity9, s5histdatasyncintegerentity9 from s5histdatasyncintegerblobentity9 INNER JOIN s5histdatasyncintegerentity9 where s5histdatasyncintegerblobentity9.gwid = s5histdatasyncintegerentity9.gwid and s5histdatasyncintegerentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdatasyncstringblobentity0, s5histdatasyncstringentity0 from s5histdatasyncstringblobentity0 INNER JOIN s5histdatasyncstringentity0 where s5histdatasyncstringblobentity0.gwid = s5histdatasyncstringentity0.gwid and s5histdatasyncstringentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity1, s5histdatasyncstringentity1 from s5histdatasyncstringblobentity1 INNER JOIN s5histdatasyncstringentity1 where s5histdatasyncstringblobentity1.gwid = s5histdatasyncstringentity1.gwid and s5histdatasyncstringentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity2, s5histdatasyncstringentity2 from s5histdatasyncstringblobentity2 INNER JOIN s5histdatasyncstringentity2 where s5histdatasyncstringblobentity2.gwid = s5histdatasyncstringentity2.gwid and s5histdatasyncstringentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity3, s5histdatasyncstringentity3 from s5histdatasyncstringblobentity3 INNER JOIN s5histdatasyncstringentity3 where s5histdatasyncstringblobentity3.gwid = s5histdatasyncstringentity3.gwid and s5histdatasyncstringentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity4, s5histdatasyncstringentity4 from s5histdatasyncstringblobentity4 INNER JOIN s5histdatasyncstringentity4 where s5histdatasyncstringblobentity4.gwid = s5histdatasyncstringentity4.gwid and s5histdatasyncstringentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity5, s5histdatasyncstringentity5 from s5histdatasyncstringblobentity5 INNER JOIN s5histdatasyncstringentity5 where s5histdatasyncstringblobentity5.gwid = s5histdatasyncstringentity5.gwid and s5histdatasyncstringentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity6, s5histdatasyncstringentity6 from s5histdatasyncstringblobentity6 INNER JOIN s5histdatasyncstringentity6 where s5histdatasyncstringblobentity6.gwid = s5histdatasyncstringentity6.gwid and s5histdatasyncstringentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity7, s5histdatasyncstringentity7 from s5histdatasyncstringblobentity7 INNER JOIN s5histdatasyncstringentity7 where s5histdatasyncstringblobentity7.gwid = s5histdatasyncstringentity7.gwid and s5histdatasyncstringentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity8, s5histdatasyncstringentity8 from s5histdatasyncstringblobentity8 INNER JOIN s5histdatasyncstringentity8 where s5histdatasyncstringblobentity8.gwid = s5histdatasyncstringentity8.gwid and s5histdatasyncstringentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasyncstringblobentity9, s5histdatasyncstringentity9 from s5histdatasyncstringblobentity9 INNER JOIN s5histdatasyncstringentity9 where s5histdatasyncstringblobentity9.gwid = s5histdatasyncstringentity9.gwid and s5histdatasyncstringentity9.debugEndTime < @REMOVE_TO_TIME;

delete s5histdatasynctimestampblobentity0, s5histdatasynctimestampentity0 from s5histdatasynctimestampblobentity0 INNER JOIN s5histdatasynctimestampentity0 where s5histdatasynctimestampblobentity0.gwid = s5histdatasynctimestampentity0.gwid and s5histdatasynctimestampentity0.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity1, s5histdatasynctimestampentity1 from s5histdatasynctimestampblobentity1 INNER JOIN s5histdatasynctimestampentity1 where s5histdatasynctimestampblobentity1.gwid = s5histdatasynctimestampentity1.gwid and s5histdatasynctimestampentity1.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity2, s5histdatasynctimestampentity2 from s5histdatasynctimestampblobentity2 INNER JOIN s5histdatasynctimestampentity2 where s5histdatasynctimestampblobentity2.gwid = s5histdatasynctimestampentity2.gwid and s5histdatasynctimestampentity2.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity3, s5histdatasynctimestampentity3 from s5histdatasynctimestampblobentity3 INNER JOIN s5histdatasynctimestampentity3 where s5histdatasynctimestampblobentity3.gwid = s5histdatasynctimestampentity3.gwid and s5histdatasynctimestampentity3.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity4, s5histdatasynctimestampentity4 from s5histdatasynctimestampblobentity4 INNER JOIN s5histdatasynctimestampentity4 where s5histdatasynctimestampblobentity4.gwid = s5histdatasynctimestampentity4.gwid and s5histdatasynctimestampentity4.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity5, s5histdatasynctimestampentity5 from s5histdatasynctimestampblobentity5 INNER JOIN s5histdatasynctimestampentity5 where s5histdatasynctimestampblobentity5.gwid = s5histdatasynctimestampentity5.gwid and s5histdatasynctimestampentity5.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity6, s5histdatasynctimestampentity6 from s5histdatasynctimestampblobentity6 INNER JOIN s5histdatasynctimestampentity6 where s5histdatasynctimestampblobentity6.gwid = s5histdatasynctimestampentity6.gwid and s5histdatasynctimestampentity6.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity7, s5histdatasynctimestampentity7 from s5histdatasynctimestampblobentity7 INNER JOIN s5histdatasynctimestampentity7 where s5histdatasynctimestampblobentity7.gwid = s5histdatasynctimestampentity7.gwid and s5histdatasynctimestampentity7.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity8, s5histdatasynctimestampentity8 from s5histdatasynctimestampblobentity8 INNER JOIN s5histdatasynctimestampentity8 where s5histdatasynctimestampblobentity8.gwid = s5histdatasynctimestampentity8.gwid and s5histdatasynctimestampentity8.debugEndTime < @REMOVE_TO_TIME;
delete s5histdatasynctimestampblobentity9, s5histdatasynctimestampentity9 from s5histdatasynctimestampblobentity9 INNER JOIN s5histdatasynctimestampentity9 where s5histdatasynctimestampblobentity9.gwid = s5histdatasynctimestampentity9.gwid and s5histdatasynctimestampentity9.debugEndTime < @REMOVE_TO_TIME;

# commit;
